package com.lwf.fatapi.entities;

import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 组织单元实体类
 *
 * @author lwf
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("organization_unit")
@Schema(description = "组织单元")
public class OrganizationUnit {

    @Id(keyType = KeyType.Auto)
    @Schema(description = "组织单元ID")
    private Long id;

    @Schema(description = "项目ID")
    private Long projectId;

    @Schema(description = "父级单元ID")
    private Long parentId;

    @Schema(description = "单元名称")
    private String unitName;

    @Schema(description = "单元编码")
    private String unitCode;

    @Schema(description = "单元类型")
    private String unitType;

    @Schema(description = "层级数")
    private Integer levelNum;

    @Schema(description = "排序")
    private Integer sortOrder;

    @Schema(description = "描述")
    private String description;

    @Schema(description = "位置信息")
    private String location;

    @Schema(description = "状态：0-禁用，1-启用")
    private Integer status;

    @Schema(description = "创建时间")
    private LocalDateTime createTime;

    @Schema(description = "更新时间")
    private LocalDateTime updateTime;

    @Schema(description = "创建人")
    private Long createBy;

    @Schema(description = "更新人")
    private Long updateBy;

    @Schema(description = "是否删除：0-否，1-是")
    private Integer isDeleted;

    // 用于返回树形结构的子节点
    @Schema(description = "子节点")
    private List<OrganizationUnit> children;
}
